from PyQt5.QtGui import *
from PyQt5.QtWidgets import *


def input_dialog(date='', bill=''):  #
    edit_dialog = QDialog()  #
    group = QGroupBox('input_dialog', edit_dialog)  #
    lbl_date = QLabel('prameter1:', group)
    le_date = QLineEdit(group)
    le_date.setValidator(QIntValidator())
    lbl_bill = QLabel('prameter2:', group)
    le_bill = QLineEdit(group)
    le_bill.setValidator(QIntValidator())
    ok_button = QPushButton('OK', edit_dialog)  #
    cancel_button = QPushButton('CANCEL', edit_dialog)
    ok_button.clicked.connect(edit_dialog.accept)  #
    ok_button.setDefault(True)
    cancel_button.clicked.connect(edit_dialog.reject)  #
    group_layout = QVBoxLayout()
    group_item = [lbl_date, le_date,
                  lbl_bill, le_bill]
    for item in group_item:
        group_layout.addWidget(item)
    group.setLayout(group_layout)
    group.setFixedSize(group.sizeHint())  #
    button_layout = QHBoxLayout()
    button_layout.addWidget(ok_button)
    button_layout.addWidget(cancel_button)
    dialog_layout = QVBoxLayout()
    dialog_layout.addWidget(group)
    dialog_layout.addLayout(button_layout)
    edit_dialog.move(1200, 400)
    edit_dialog.setLayout(dialog_layout)
    edit_dialog.setFixedSize(edit_dialog.sizeHint())
    if edit_dialog.exec():
        date = le_date.text()
        bill = le_bill.text()
        return True, date, bill
    return False, None, None


def show_mes(input):
    hint_msg = QMessageBox()
    hint_msg.setText(input)
    hint_msg.addButton(QMessageBox.Ok)
    hint_msg.exec()


